package bsf.baseservice.businessmq.dal;

import bsf.baseservice.businessmq.model.tb_log_model;
import bsf.db.DbConn;
import bsf.util.ConvertUtil;

import java.util.Map;

public class tb_log_dal
{
	public boolean add(DbConn PubConn, tb_log_model model)
	{
		int rev = PubConn.executeSql("insert into tb_log(mqpathid,mqpath,methodname,info,createtime)" +
				" values(?,?,?,?,?)",
				new Object[]{model.mqpathid,model.mqpath,model.methodname,model.info,model.createtime});
		return rev == 1;

	}



	public tb_log_model createModel(Map<String,Object> dr)
	{
		tb_log_model o = new tb_log_model();

		//
		if(dr.containsKey("id"))
		{
			o.id= ConvertUtil.objToInt64(dr.get("id"));
		}
		//
		if(dr.containsKey("mqpathid"))
		{
			o.mqpathid= ConvertUtil.objToInt(dr.get("mqpathid"));
		}
		//
		if(dr.containsKey("mqpath"))
		{
			o.mqpath= ConvertUtil.nullToStr(dr.get("mqpath"));
		}
		//
		if(dr.containsKey("methodname"))
		{
			o.methodname= ConvertUtil.nullToStr(dr.get("methodname"));
		}
		//
		if(dr.containsKey("info"))
		{
			o.info= ConvertUtil.nullToStr(dr.get("info"));
		}
		//
		if(dr.containsKey("createtime"))
		{
			o.createtime= ConvertUtil.objToDateTime(dr.get("createtime"));
		}
		return o;
	}
}